package com.platform.hjt.sys.service;

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import com.hjt.tools.dao.Page;
import com.hjt.tools.dao.PropertyFilter;
import com.platform.hjt.base.controller.ReturnBody;
import com.platform.hjt.base.service.BaseService;
import com.platform.hjt.sys.dao.SysLoginLogDAO;
import com.platform.hjt.sys.model.SysLoginLog;

@Service
public class SysLoginLogService extends BaseService{

	@Resource
	private SysLoginLogDAO sysLoginLogDAO;
	
	public ReturnBody saveSysLoginLog(SysLoginLog sysLoginLog){
		if(StringUtils.isNotBlank(sysLoginLog.getLoginLogId())){
			sysLoginLogDAO.updatePerproties(sysLoginLog);
			return  new ReturnBody(true, "更新成功");
		}else{
			 sysLoginLogDAO.saveJ(sysLoginLog);
			return  new ReturnBody(true, "添加成功");
		}
	}
	
	public Page<SysLoginLog> getSysLoginLogList(Page<SysLoginLog> page, List<PropertyFilter> propertyFilterList){
		return sysLoginLogDAO.findPage(page, PropertyFilter.buildFromHttpRequest(getRequest()));
	}
	
	public List<SysLoginLog> getSysLoginLogList(List<PropertyFilter> filters){
		return sysLoginLogDAO.find(filters);
	}
	
	public SysLoginLog getSysLoginLog(List<PropertyFilter> filters){
		return sysLoginLogDAO.findUniqueBy(filters);
	}
	
	public SysLoginLog getSysLoginLog(String propertyName, Object value){
		return sysLoginLogDAO.findUniqueBy(propertyName, value);
	}
	
}
